home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20031118-20041115 / 000218_fdc@columbia.edu_Sat Apr 17 14:11:15 2004.msg < prev    next >
Text File  |  2020-01-01  |  5KB  |  107 lines

  1. Path: newsmaster.cc.columbia.edu!not-for-mail
  2. From: Frank da Cruz <fdc@columbia.edu>
  3. Newsgroups: comp.os.linux.misc,comp.protocols.kermit.misc
  4. Subject: Re: logging data from com-port to a file
  5. Date: 17 Apr 2004 18:09:50 GMT
  6. Organization: Columbia University
  7. Lines: 90
  8. Message-ID: <slrnc82sne.2aq.fdc@sesame.cc.columbia.edu>
  9. References: <c5rav3$vnt$1@newsreader1.utanet.at> <40814a75$0$17263$a1866201@newsreader.visi.com> <c5ri2b$4p1$1@newsreader1.utanet.at> <40815dad$0$17253$a1866201@newsreader.visi.com> <c5rn96$84g$1@newsreader1.utanet.at>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: sesame.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1082225390 29232 128.59.59.56 (17 Apr 2004 18:09:50 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 17 Apr 2004 18:09:50 GMT
  15. User-Agent: slrn/0.9.8.0 (SunOS)
  16. Xref: newsmaster.cc.columbia.edu comp.os.linux.misc:628716 comp.protocols.kermit.misc:14934
  17.  
  18. On 2004-04-17, z3r0c00l <z3r0c00l@utanet.at> wrote:
  19. : Grant Edwards wrote:
  20. :> In article <c5ri2b$4p1$1@newsreader1.utanet.at>, z3r0c00l wrote:
  21. :>>>>hi, i need a tool which i can log data from the com-port to a file
  22. :>>>>(it should log immediatly)
  23. :>>>>does anybody know?
  24. :>>>
  25. :>>>$ cat /dev/ttyS1 >logfile
  26. : ...
  27. :>>i tried this before, but it didn't really work
  28. :
  29. :> Then you're going to have to cough up a few details about what
  30. :> you're trying to do, what you've tried, and what you mean by
  31. :> "didn't really work".
  32. :> 
  33. : i tried to catch data from a siemens telephone
  34. : first it didn't work, then  i also ran some other software and suddenly 
  35. : the data was split up between the cat and the other software, but when i 
  36. : ran cat only, it didn't receive any data, so i didn't try cat any more
  37. :
  38. Use C-Kermit:
  39.  
  40.   http://www.columbia.edu/kermit/ckermit.html
  41.  
  42. Here's a little script, that takes advantage of a new feature of C-Kermit
  43. 8.0.211, released just a few days ago (INPUT /NOMATCH).  Replace the device
  44. name and other parameters as needed, or make them parameters:
  45.  
  46.   #!/p/kd/fdc/solaris9/wermit +
  47.   #
  48.   .port := /dev/ttyS1            # Serial port to use
  49.   if >= \v(argc) 2 {             # Take log file name from command line
  50.       .file := \%1
  51.   } else {                       # Prompt for it if not given
  52.       while not def file {
  53.       ask file " Log file name: "
  54.       }
  55.   }
  56.   if not writeable \m(file) {    # Make sure it's writeable
  57.       exit 1 "\m(file): Not writeable"
  58.   }
  59.   set modem type none            # No modem is involved
  60.   set port /dev/ttyS1            # Or whatever port you are using
  61.   if fail {                      # Check that port was obtained
  62.       exit 1 \m(port): \v(setlinemsg)
  63.   }
  64.   set speed 9600                 # Or whatever speed is needed
  65.   set flow rts/cts               # Or Xon/Xoff, or None
  66.   set parity none                # Or Even, Mark, Space, or Odd as needed
  67.   set session-log text           # (see below)
  68.   log session \m(file)           # Start the session log
  69.   if fail exit 1                 # Make sure this worked
  70.   input /nomatch 23:59:59        # Log until midnight
  71.   if fail {                      # Catch i/o errors
  72.       exit 1 "\m(port): I/O error"
  73.   }
  74.   close session                  # Close the log
  75.   exit 0
  76.  
  77. Various session-log formats are available.  To find out what they are,
  78. type "help set session-log" at the C-Kermit> prompt, and see:
  79.  
  80. Syntax: SET SESSION-LOG { BINARY, DEBUG, TEXT, TIMESTAMPED-TEXT }
  81.   If BINARY, record all CONNECT characters in session log.  If TEXT, strip
  82.   out CR, NUL, and XON/XOFF characters.  DEBUG is the same as BINARY but
  83.   also includes Telnet negotiations on TCP/IP connections.
  84.  
  85. TIMESTAMPED-TEXT, as the name implies, is text but with timestamps placed
  86. at the beginning of each line.
  87.  
  88. The INPUT command is what reads and logs the incoming material.  Type
  89. HELP INPUT and HELP SET INPUT to find out parameters and options.  In this
  90. case it simply reads incoming material and logs it until the given time
  91. of day.  Thus you could use the above script in a cron job to keep a daily
  92. log of of your PBX.  Or hourly, or whatever else you wanted.
  93.  
  94. For more about session logging, type "help log".  Note that the session
  95. can be not only a file, but also a pipe.
  96.  
  97. For more about Kermit scripting, see the tutorial here:
  98.  
  99.   http://www.columbia.edu/kermit/ckscripts.html
  100.  
  101. For a tutorial on C-Kermit itself, see:
  102.  
  103.   http://www.columbia.edu/kermit/ckututor.html
  104.  
  105. Frank da Cruz
  106. The Kermit Project
  107. Columbia University